<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>23_鼠标事件-鼠标移入移出-onmouseover-onmouseout</title>
        <style>
            div {
                width: 200px;
                height: 200px;
                background-color: aqua;
            }
        </style>
    </head>
    <body>
        <div></div>
        <script>
            var div = document.querySelector('div');

            div.onmouseenter = function(){
                this.style.backgroundColor = 'yellowgreen';
            }

            div.onmouseleave = function(){
                // 如果这个颜色什么都不写  那么会恢复到原来的颜色
                this.style.backgroundColor = 'hotpink';
            }
        </script>
    </body>
</html>